package testcase.validationtest;

import validation.Type;
import validation.Solo;
import card.*;
import junit.framework.TestCase;

public class SoloTest extends TestCase {
	private Type solo;
	private Cardset cardset;
	
		
	/**
	* Sets up the test fixture.
	*
	* Called before every test case method.
	*/
	public void setUp() {	
		solo = Solo.getInstance();
		solo.clear();
		cardset = new Cardset(1);
		solo = Solo.getInstance();
	}
	
	/**
	* Tears down the test fixture.
	*
	* Called after every test case method.
	*/
	public void tearDown() {		
	}
	
	//Test case 1: Identify h3 
	public void testIdentifySingleCard1() {
		cardset.add(new Card('h', '3'));
		Type result = solo.identify(cardset);
		assertEquals(result, solo);
	}
	
	//Test case 2: Identify d9
	public void testIdentifySingleCard2() {
		cardset.add(new Card('d', '9'));
		Type result = solo.identify(cardset);
		assertEquals(result, solo);
	}
	
	//Test case 3: Identify cX hJ
	public void testIdentifyDoubleCard1() {
		cardset.add(new Card('c', 'X'));
		cardset.add(new Card('h', 'J'));
		Type result = solo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 4: Identify sA hA
	public void testIdentifyDoubleCard2() {
		cardset.add(new Card('s', 'A'));
		cardset.add(new Card('h', 'A'));
		Type result = solo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 5: Identify s3 h5 s4 
	public void testIdentifyTripleCard1() {
		cardset.add(new Card('s', '3'));
		cardset.add(new Card('h', '5'));
		cardset.add(new Card('s', '4'));
		Type result = solo.identify(cardset);
		assertEquals(result, null);
	}
	
	//Test case 6: s7 is not prior to h5
	public void test5IsNotPriorTo7() {		
		cardset.add(new Card('h', '5'));
		Cardset testHand = new Cardset(1);		
		testHand.add(new Card('s', '7'));
		boolean test = solo.lessPriorityThan(cardset);
		assertEquals(test,true);
		boolean result = solo.lessPriorityThan(testHand);
		assertEquals(result, true);
	}	
	
	//Test case 7: cJ is not prior to hA
	public void testJIsNotPriorToA() {
		cardset.add(new Card('c', 'J'));
		Cardset testHand = new Cardset(1);		
		testHand.add(new Card('h', 'A'));
		solo.lessPriorityThan(cardset);
		boolean result = solo.lessPriorityThan(testHand);
		assertEquals(result, true);
	}
	
	//Test case 8: cK is prior to s2
	public void test2IsNotPriorToK() {
		cardset.add(new Card('s', '2'));
		Cardset testHand = new Cardset(1);		
		testHand.add(new Card('c', 'K'));
		solo.lessPriorityThan(cardset);
		boolean result = solo.lessPriorityThan(testHand);
		assertEquals(result, false);
	}
	
	//Test case 9: cX is prior to sX
	public void testXIsNotPriorToX() {
		cardset.add(new Card('c', 'X'));
		Cardset testHand = new Cardset(1);		
		testHand.add(new Card('s', 'X'));
		solo.lessPriorityThan(cardset);
		boolean result = solo.lessPriorityThan(testHand);
		assertEquals(result, false);
	}
	
	//Test case 10: gB is not prior to gR
	public void testBIsNotPriorToR() {
		cardset.add(new Card('g', 'B'));
		Cardset testHand = new Cardset(1);		
		testHand.add(new Card('g', 'R'));
		solo.lessPriorityThan(cardset);
		boolean result = solo.lessPriorityThan(testHand);
		assertEquals(result, true);
	}	
	
}
